-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customize shortcut modifier and forward Ctrl and Shift to the device #1598
Conversation
When the client requests to set the clipboard, it may request to press the PASTE key in addition. To be a bit generic, it was stored as a flag in ControlMessage.java. But flags suggest that it represents a bitwise union. Use a simple boolean instead.
The condition "cmd" was always before "shift" in all expressions except 4.
Oh, when pressing Alt+c, SDL generates a text event ( As a consequence, when EDIT: fixed by 19691d6, I updated the binaries. |
Hello, under the default ALT shortcut, ALT+W has no effect on removing black borders. |
@Helaer It works fine for me on a PT-PT keyboard. What's your keyboard layout? @rom1v Works awesome to me. After some use, I settled with |
I didn't pass in a set of bytes, the default shortcut used, ALT+W can not remove the black border of the window. |
Which platform/window manager? On Debian+XFCE, Alt+w works fine. @brunoais Thank you for your feedbacks 👍
On a French keyboard, AltGr is used to generate many chars (AltGr+0 is
Oh, a segmentation fault on the client side or device side? (does it appear in Add meson configure x -Db_sanitize
ninja -Cx
./run x |
My system is Windows 10. |
I just tested on Windows 10: I resized the scrcpy window so that there are black borders, then I pressed Alt+w, it works for me, the window is automatically resized so that black borders are gone. |
I restarted my computer and it responded, guessing that other applications blocked the key combination. |
I have such too. Except it never worked in scrcpy. I end up using the phone's virtual keyboard for those characters.
I'm not sure, I can only see a connection lost on logcat. No process dump or stack trace.
When I forcefully replace the server code you uploaded there into the resulted client compilation, yes.
When I do it like that, everything runs right. I think ninja is recompiling when I run it like that. So I think I would need to run it in some different way so it uses the server you uploaded there while using the client code from my side. Regardless, if I checkout |
Even with
What about: meson configure x -Dprebuilt_server=/path/to/your/prebuilt/scrcpy-server
... ? |
Yeah... It does solve... Thank you.
I didn't know that option existed I'll try that tomorrow. |
No crash if I do like that. |
@rom1v Just want to mention that on my platform, Windows 10, Samsung Galaxy S5, the two most recent binaries are working perfectly. Have tested passing ctrl keys for bash in termux, and everything I've thought of has been flawless. I'm using the "hacker's keyboard" keyboard replacement app also, if that matters. Also tested scrcpy builtins for turn off screen, pull menushade, switch programs, etc. All working fine. Thank you so, so much for this. This is saving me a ton of agony futzing with the soft keyboard in termux. |
@AzureRaptor Thank you very much for your feedbacks. It's very helpful 👍 |
I have noticed something else that is a bit odd, although not insurmountable thus far. Somehow, after an indeterminate period of time (it seems to take more than half an hour - I think - I'm sorry I haven't timed this better) scrcpy seems to get into a state where the middle mouse-button no longer works for "home." If I click it, nothing happens. I've given it over a minute to respond during times when the phone is not being used or cpu-stressed. If I just close and restart scrcpy the behavior stops and middle button works again. |
Except HOME, everything continued workibg (left-clock, BACK...)? Did you reproduce it several times? |
Yes, that's pretty much exactly what I observed. Middle-button failure for HOME was the only unexpected result. I've observed it at least three times now. |
If you reproduce it again, could you test whether Ctrl+h (for HOME) still works when middle-clic fails, please? |
Also, can you reproduce it on a version which do not include the changes from this PR? |
Ok. Have just tested the build from this PR, and ALT-H (which is what I expect for this build, right?) works for home. This is good. I'll try to test a report on the last stable as soon as I can. I'm glad I kept those binaries around and renamed them. It's basically going to involve me digging out some idle time and letting the phone sit and wait, because I really need the keyboard functionality this build to work sanely at all. 🤣 |
I have an update. Still haven't tested out the older binaries yet, sorry, but just a little while ago this pull got into a state where both middle-click and alt-h did not respond. I'm afraid I closed it before I tested other inputs (was in the middle of working and it was stopping me 😒). Next time this happens, I'll try to see what else is responding at the time. Hopefully this was maybe a one-off fluke. |
I didn't enable right-Alt by defauly because it is sometimes AltGr, which is used for many characters. |
@rom1v I noticed you'd added some commits and merged a couple of days ago. Are the binaries and checksums linked at the top, in the first post, still valid, or are there others somewhere? I'm guessing they aren't and there must be others, but I don't know how to find them. I apologize in advance if this is something very basic to github I should be able to tell from the posts. 😟 |
No, there are no binaries for the current |
I have some good news and bad news. 😅 On the plus side, I have a logcat file for you. I also can still confirm that all other keystrokes/mouseclicks seem to be working fine. I even enabled both left & right alt as per your cmdline suggestion above; having both works better for me. On the less-than-plus side, even though I definitely cleared the log as per your instructions further above, the problem didn't show up until I'd been working for several hours. The logcat file is ~3M. I doubt that would paste well here, and it's waaay above even the max size on pastebin. I'm not sure how to get it to you or make it available. I'm open to suggestions. Thank you very much for your ongoing patience and work on this. |
OK, thank you for the feedback. 👍 I think that the middle-click issue you observe is not related to this PR anyway (and maybe not to scrcpy at all, I can't see a reason why only this key would stop working, you should check whether SDL still receives the event when it fails, by adding a log). |
@AzureRaptor So I was totally wrong, I failed to find the issue before the release 😞 |
Please don't feel bad about this. I'm really sorry I was never able to get you a good logcat, but they just got huge before the problem ever showed up and I couldn't figure out a good way to make them public (aside from something like dropbox or gdrive, which would've been a different kind of irritating). I really find scrcpy indispensable. I wish I had the cash to support your development; the work you're putting in is amazing. |
This is captured by your system so scrcpy is not even aware that you press alt+tab. |
Anyway, in OTG mode there are no scrcpy shortcuts. |
if scrcpy is not aware of the |
It captures Alt, but if you press Tab in addition, it is captured by the system. |
in otg mode when i press either Super or left Alt key the focus moves back to laptop, how can i make it so only when i press Super key the focus will change, not any other key? |
The mouse capture keys are hardcoded: scrcpy/app/src/usb/screen_otg.c Lines 139 to 142 in 7f23ff3
|
what was the last version which it was not hardcoded? why did you hardcode both super key and left alt key, why not just super key? |
It is hardcoded since the beginning: 91418c7
Because different OS and desktop environments (and virtual machines) capture different keys, so I wanted a working solution for all cases. |
since you hardcoded those 2 keys since the beginning when otg mode feature was created there's no version of scrcpy i can revert back to achieve what i want, which left me with a remaining option is to find a way to configure my specific environment so it will only capture Super key, would that be possible now? |
This is open source. Clone the project, change the line to adapt, rebuild 😉 |
This PR replaces the two previous attempts #1446 and #1465.
It forwards Ctrl and Shift to the device. This allows for example to press Ctrl+t in Firefox to open a new tab, Ctrl+w to close the current tab. Ctrl+c or Ctrl+d can now be injected in Termux.
This also greatly simplifies text selection, by using the keyboard (Shift+arrows, Ctrl+a…), and simplifies copy-paste (Ctrl+c) and cut-paste (Ctrl+x). Ctrl+z could be used to cancel an action, like a change in a text field for example.
As a consequence, scrcpy shortcuts are not bound to Ctrl anymore, but to (left) Alt and (left) Cmd by default. This modifier can be changed by a command-line parameter (
--shortcut-mod
), as explained here.Here is the list of the changes:
COPY
,CUT
andPASTE
keycodes (see README for details)CUT
to MOD+x, the "resize to fit" shortcut (which removes the black borders) has been changed to MOD+wThis fixes #555 and #942.
Feedbacks (and reviews) welcome :)
Binaries
EDIT: just take v1.15 release.
old
For windows users, take both `scrcpy.exe` and `scrcpy-server`, and replace them in your scrcpy v1.14 release.For other platforms, take
scrcpy-server
and build only the client.scrcpy.exe
SHA256: ceab026bff28c8851456e30d3e1449ad25ef6aedeec6fcac00ad508e2f67a9cf
scrcpy-server
SHA256: b7b4f2f5d008cf6191c8fab6f74cc43bfc78bd33c4a4100274a9f4fa717b59e8